/* 
* Filename:  PWMModule.h
* Creation date:      08.05.2013
* Originator:    Anton Babushkin (Antony.Babushkin@gmail.com)
* Revision history:
*   V1.01 08.05.2013 - Creation
* Description:
*   Pulse Width Modulation Module header file.
*/
#ifndef __PWM_Module__
#define __PWM_Module__

#include <stdint.h>

/* IO definitions */
#ifndef __IO
#define __IO		volatile// Defines read/write permission
#endif // __IO

// Control register type definition
typedef union
{
	struct
	{
		uint32_t DivReset				: 1;// bit 0	DivReset (strobe signal, will be reset after 1 Clk cycle)
		uint32_t PwmReset				: 1;// bit 1	PwmReset (strobe signal, will be reset after 1 Clk cycle)
		uint32_t InverseEn			: 1;// bit 2	InverseEn (Read/Write)
		uint32_t OutEnable			: 1;// bit 3	OutEnable (Read/Write)
		uint32_t Done						: 1;// bit 4	Done (Read Only)
		uint32_t Reserved3			: 27;// bit 5..31
	} b;// Bit access
	uint32_t w;// Word access
} control_reg_t;

// PWM Module registers type definition
typedef struct
{
	__IO 	control_reg_t Control;// Control register
	__IO 	uint16_t DivFactor;// Division Fator register
			uint16_t Reserved;// Reserved
	__IO 	uint32_t PulseLen;// Pulse Length register
	__IO 	uint32_t PeriodLen;// Period Length register
} pwm_module_t;

#endif // __PWM_Module__
